package lzzy8;

public class Student implements Comparable<Student>{
    private String id;
    private String name;
    private String stu_id;
    private double area;

    public Student(String id, String name, String stu_id, double area){
        this.id=id;
        this.name=name;
        this.stu_id=stu_id;
        this.area=area;
    }

    @Override
    public String toString(){
        return "Student{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", stu_id='" + stu_id + '\'' +
                ",area='" + area + '\'' +
                '}';
    }

    public int compareTo(Student o) {
        if (area > o.area)
            return 1;
        else if (area < o.area)
            return -1;
        else
            return 0;
    }
}
